home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 May
/
EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso
/
earcd
/
comm
/
mail
/
yamlist.lha
/
listserv.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-02-21
|
7KB
|
213 lines
/*
** $VER: ListServ.rexx 1.0 (12.30.96)
**
** Written by Peter Greci <midgard@nycmetro.com>
**
** It runs the following ARexx scripts to maintain a mailing List
**/
/*
** $VER: Subscribe.rexx 1.0 (12.30.96)
**
** Written by Peter Greci <midgard@nycmetro.com>
**
** It scans the incoming folder for messages with the subject
** "Subscribe" and adds the sender to the list.
**/
OPTIONS RESULTS
ADDRESS YAM
SetFolder 0 /* go to Incoming folder */
GetFolderInfo MAX; entries = RESULT /* get number of mail */
DO i=0 TO entries-1 /* scan all mail */
SetMail i /* set topical mail */
GetMailInfo SUBJECT /* ask for subject */
IF upper(RESULT) = 'SUBSCRIBE' THEN DO /* criteria accomplished */
GetMailInfo FROM /* ask for sender and */
ret=RESULT /* save as variable ret */
ADDRESS REXX
parse var ret crap '<'user'>' .
open('plist','listserv:list','A') /* open pistol list file */
writech('plist',user) /* writes new user to file */
close('plist')
ADDRESS YAM
mailarchive 3
mailwrite /* Sends a Welcome to new */
writemailto user /* subscribers */
writesubject 'Welcome'
writeletter 'listserv:welcome'
writequeue
mailsendall
setfolder 3
maildelete
setfolder 0
END
END
/* exit */
/*
** $VER: Unsubscribe.rexx 1.0 (12.30.96)
**
** Written by Peter Greci <midgard@nycmetro.com>
**
** It scans the incoming folder for messages with the subject
** "unSubscribe" and removes the sender to the list.
**/
SetFolder 0 /* go to Incoming folder */
GetFolderInfo MAX; entries = RESULT /* get number of mail */
DO i=0 TO entries-1 /* scan all mail */
SetMail i /* set topical mail */
GetMailInfo SUBJECT /* ask for subject */
IF upper(RESULT) = 'UNSUBSCRIBE' THEN DO /* criteria accomplished */
GetMailInfo FROM /* ask for sender and */
ret=RESULT /* save as variable ret */
parse var ret crap '<'user'>'
if verifyuser(user) then removeuser(user)
mailarchive 3
mailwrite /* Bids Goodbye to a */
writemailto user /* subscriber */
writesubject 'GoodBye'
writeletter 'listserv:bye'
writequeue
mailsendall
END
END
/* exit */
/*
** $VER: Help.rexx 1.0 (12.30.96)
**
** Written by Peter Greci <midgard@nycmetro.com>
**
** It scans the incoming folder for messages with the subject
** "help" and sends help to the sender.
**/
SetFolder 0 /* go to Incoming folder */
GetFolderInfo MAX; entries = RESULT /* get number of mail */
DO i=0 TO entries-1 /* scan all mail */
SetMail i /* set topical mail */
GetMailInfo SUBJECT /* ask for subject */
IF upper(RESULT) = 'HELP' THEN DO /* criteria accomplished */
GetMailInfo FROM /* ask for sender and */
ret=RESULT /* save as variable ret */
mailarchive 3
mailwrite /* Sends the lists Help */
writemailto ret /* file to a subscriber */
writesubject 'Helpfile'
writeletter 'listserv:help'
writequeue
mailsendall
setfolder 3
maildelete
setfolder 0
END
END
/* exit */
/*
** $VER: list.rexx 1.0 (12.30.96)
**
** Written by Peter Greci <midgard@nycmetro.com>
**
** It scans the incoming folder for messages with the subject
** "list" and sends to the sender to the list of users subscribed.
**/
SetFolder 0 /* go to Incoming folder */
GetFolderInfo MAX; entries = RESULT /* get number of mail */
DO i=0 TO entries-1 /* scan all mail */
SetMail i /* set topical mail */
GetMailInfo SUBJECT /* ask for subject */
IF upper(RESULT) = 'LIST' THEN DO /* criteria accomplished */
GetMailInfo FROM /* ask for sender and */
ret=RESULT /* save as variable ret */
mailarchive 3
mailwrite /* Sends the list of */
writemailto ret /* users to those who */
writesubject 'Users-List' /* who request it */
writeletter 'listserv:list'
writequeue
mailsendall
setfolder 3
maildelete
setfolder 0
END
END
/* exit */
/*
** $VER: Forward.rexx 1.0 (12.30.96)
**
** Written by Peter Greci <midgard@nycmetro.com>
**
** It forwards messages from the incoming folder to members of the
** mailing list.
**/
getconfiginfo ema
myemail=RESULT
parsevar myemail myname '@' crap .
SetFolder 0
GetFolderInfo MAX; entries = RESULT
ADDRESS REXX
Do Until eof('plist')=1
open('plist','listserv:list','R')
newad=readln('plist')
ADDRESS YAM
DO i=0 TO entries-1
SetMail i
GetMailInfo SUBJECT
sub=RESULT
GetMailInfo FROM
ret=RESULT
parse var ret crap '<'user'>' .
parse var newad crap '<'testad'>' .
if verifyuser(user) &, /* validate user mail*/
upper(user)~=upper(myname) &, /* dont send to admin*/
upper(user)~=upper(testad) then do /* dont send a bounce*/
mailforward
writemailto newad
writequeue
end
END
END
if entries>0 then do
mailsendall
mailarchive 3
setfolder 3
maildelete
setfolder 0
end
EXIT
verifyuser:
parse arg test .
open('checklist','listserv:list','R')
do until eof('checklist')
checkuser=readln('checklist')
if upper(checkuser)=upper(test) then do
close(checklist)
return 1
end
end
close('checklist')
return 0
removeuser:
parse arg test .
open('newlist','listserv:temp','W')
open('oldlist','listserv:list','R')
do until eof('oldlist')
checkuser=readln('oldlist')
if upper(checkuser)~=upper(test) then writeln('newlist')
end
close('newlist')
close('oldlist')
delete('listserv:list')
rename('listserv:temp','listserv:list')
return 0